﻿var Services;
(function (Services) {
    Services.signIn = function (userId, onDone) {
        return $.ajaxInvokeByJSON("Membership/SignIn", { UserId: userId })
            .done(extendOnDone(onDone));
    };

    Services.signOut = function (onDone) {
        return $.ajaxInvokeByJSON("Membership/SignOut")
            .done(extendOnDone(onDone));
    };

    Services.getFiles = function (onDone) {
        return $.ajaxGetByForm("Services/FileEntries")
            .done(extendOnDone(onDone));
    };

    function extendOnDone(onDone) {
        return function (d) {
            if (d != null && d.MessageType > 0) {
                alert(d.Message);
                return;
            }
            if (onDone) {
                onDone(d);
            }
        };
    }
})(Services || (Services = {}));
